package com.ytktt.study.week9.task3.rpcfx.utils;

/**
 * 字符串格式化工具类
 *
 * @author ytk
 */
public class StringFormatUtils {

    public static String upperFirstLetter(String str) {
        char firstLetter = str.charAt(0);
        if (Character.isUpperCase(firstLetter)) {
            return str;
        } else {
            return Character.toUpperCase(firstLetter) + str.substring(1);
        }
    }

    public static String lowerFirstLetter(String str) {
        char firstLetter = str.charAt(0);
        if (Character.isLowerCase(firstLetter)) {
            return str;
        } else {
            return Character.toLowerCase(firstLetter) + str.substring(1);
        }
    }

    public static String genBaseServicePath(String serviceName, String group, String version) {
        return '/' + group + '/' + serviceName + '/' + version;
    }

    public static String genRealServiceName(String serviceName, String group, String version) {
        return serviceName + ':' + group + ':' + version;
    }
}
